package com.dalong.controller;

import com.dalong.springboot.MyBean;
import com.dalong.springboot.bean.DbUser;
import com.dalong.springboot.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class HellowController {

    @Autowired
    JdbcTemplate jdbcTemplate;

    @Autowired
    MyBean myBean;


    @Autowired
    UserService userService;


    @ResponseBody
    @RequestMapping("/hello")
    public String getHello(){
        System.out.println(myBean.toString());
        List<DbUser>  userList= userService.getUserAll();
        for(int i=0;i<userList.size();i++){
            System.out.println(userList.get(i).getUsername());
        }
        return "hellor DaLong";
    }
}
